<?php

namespace app\index\model;

use think\Model;
use think\model\concern\SoftDelete;

/**
 * 异常信息记录表
 * Class UnusualRecore
 * @package app\index\model
 */
class UnusualRecord extends Model
{
    use SoftDelete;

    public $autoWriteTimestamp = 'int';
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';
    protected $append = [
        'type_text'
    ];

    public function getTypeTextAttr($value, $data)
    {
        $arrAction = ['', '超时未还', '报废预警', '柜门未关'];
        if (empty($data['type']) || empty($arrAction[$data['type']])) return '';
        return $arrAction[$data['type']];
    }

}